﻿@using XiaoYuStock.Model
@using XiaoYuStock.Model.Models
@using XiaoYuStock.Model.Request
@using XiaoYuStock.WebApp.Controls
@model PagedList<ShareList>
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section PageSpecificStyleSheetIncludes{
    <style type="text/css">
        select {
            margin: 1px;
            width: 150px;
        }
    </style>
}
<div class="row-fluid">
    <div class="span8">
        @using (Html.BeginForm(null, null, null, FormMethod.Get, new { id = "search", @class = "form-inline" }))
        {
            <div class="dataTables_filter">
              <label><button type="submit" class="btn">搜索 <i class="icon-search"></i></button></label>
                
                <label>
                    <span>股票代码：</span>
                    @Html.TextBox("ShareCode", null, new { @class = "m-wrap small" })
                </label>
                <label>
                    <span>股票名称：</span>
                    @Html.TextBox("ShareName", null, new { @class = "m-wrap small" })
                </label>
            </div>
        }
    </div>
</div>

@using (Html.BeginForm("Delete", "ShareTarget", FormMethod.Post, new { id = "mainForm" }))
{
    <table class="table table-striped table-hover ">
        <thead>
            <tr>
                <th style="width: 8px;">
                    <input type="checkbox" id="checkall" class="group-checkable" />
                </th>
                <th>
                    项目
                </th>
                <th>加入日期</th>
                <th>状态</th>
                <th>
                    备注
                </th>
       
   
                <th>
                    操作
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (var p in Model)
            {
                <tr>
                    <td>
                        <input type="checkbox" class="checkboxes" name='ids' value='@p.Id' />
                    </td>
                    <td class="blue">
                        <a target="_blank" href="@Url.Action("Index", "HistoryData", new
                            {
                                ShareCode = @p.ShareCode
                            })"><span title="@p.ShareCode"> @p.ShareCode【@p.ShareName】</span></a>
                    </td>
                    <td><span>@p.CreateDate</span></td>
                    <td>
                        <span>@p.Status</span>
                    </td>
                     
                    <td class="green">
                       <span>@p.Remark</span>
                    </td>
                    <td>
                        <a class="btn mini red thickbox" title='编辑' href="@Url.Action("Edit", new { code = p.ShareCode })&TB_iframe=true&height=500&width=500">
                            <i class="icon-edit"></i>
                            编辑
                        </a>
                        <a class="btn mini blue" title='添加自选' href="javascript:void();" onclick="addSelfTarget('@p.ShareCode')">
                            <i class="icon-edit"></i>
                            添加自选
                        </a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
}
<div class="dataTables_paginate paging_bootstrap pagination">
    @Html.Pager(Model, new PagerOptions() { ShowTotalItemCount = true })
</div>
<script>
    function addSelfTarget(sharecode)
    {
        $.post("/ShareList/AddSelfTarget", { shareCode: sharecode }, function (data) {
            if (data.status)
            {
                alert("添加自选成功");
            }else
            {
                alert("添加自选失败");
            }
        });
    }
</script>